package com.cxs.vo;

import com.cxs.enums.HospitalErrorResultEnum;

import java.util.HashMap;

/*
 * @Author:cxs
 * @Date:2021/10/15  15:03
 * @Version 1.0
 * @Motto:放下杂念,只为迎接明天更好的自己
 * */
public class Result extends HashMap {


    public static Result Ok() {
        Result result = new Result();
        result.put("code", 200);
        return result;
    }

    public static Result Ok(String msg) {
        Result result = new Result();
        result.put("code", 200);
        result.put("msg", msg);
        return result;
    }

    public static Result Ok(String msg, Object data) {
        Result result = new Result();
        result.put("code", 200);
        result.put("msg", msg);
        result.put("data", data);
        return result;
    }

    public static Result Ok(Integer code,String msg) {
        Result result = new Result();
        result.put("code", code);
        result.put("msg", msg);
        return result;
    }

    public static Result Ok(Integer code,String msg,Object data) {
        Result result = new Result();
        result.put("code", code);
        result.put("msg", msg);
        result.put("data", data);
        return result;
    }

    public static Result Ok(Object data) {
        Result result = new Result();
        result.put("code", 200);
        result.put("msg", "操作成功");
        result.put("data", data);
        return result;
    }



    public static Result Ok(HospitalErrorResultEnum enums) {
        Result result = new Result();
        result.put("code", enums.getCode());
        result.put("msg", enums.getMsg());
        return result;
    }


    public static Result failare() {
        Result result = new Result();
        result.put("code", 201);
        result.put("msg", "操作失败");
        return result;
    }

    public static Result failare(String msg) {
        Result result = new Result();
        result.put("code", 201);
        result.put("msg", msg);
        return result;
    }

    public static Result failare(Integer code, String msg) {
        Result result = new Result();
        result.put("code", code);
        result.put("msg", msg);
        return result;
    }

    public static Result failare(HospitalErrorResultEnum enums) {
        Result result = new Result();
        result.put("code", enums.getCode());
        result.put("msg", enums.getMsg());
        return result;
    }
}
